//
//  RootViewController.m
//  textReader
//
//  Created by kyocooro on 1/26/11.
//  Copyright __MyCompanyName__ 2011. All rights reserved.
//

#import "RootViewController.h"
#import "FileTable.h"
#import "MyPreferencesTable.h"
#define TABBAR_HEIGHT 49
@interface RootViewController(hidden)
- (void)setTabBarItemsTitle;
FileTable *fileTable;
MyPreferencesTable *prefsTable;
@end

@implementation RootViewController
@synthesize trApp;
- (void)setTabBarItemsTitle
{
	for (int i = 0; i < [self.tabBar.items count]; i++)
	{
		UITabBarItem *item = [self.tabBar.items objectAtIndex:i];
		switch (i) {
			case 0:
				item.title = @"Docs";
				break;
			case 1:
				item.title = @"Settings";
				break;
		}
		
	}
}
#pragma mark -
#pragma mark View lifecycle


- (void)viewDidLoad {
    [super viewDidLoad];

	
    fileTable = [[FileTable alloc] init];
	[fileTable setTextReader:trApp];
	
	prefsTable = [[MyPreferencesTable alloc] initWithNibName:@"MyPreferencesTable" bundle:nil];
	[prefsTable setTextReader:trApp];
	prefsTable.textView = trApp.textView;
	
	NSArray *listVC = [[NSArray alloc] initWithObjects:fileTable, prefsTable, nil];
	[self setViewControllers:listVC animated:NO];
	[listVC release];
	
	[self setTabBarItemsTitle];
}


/*
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}
*/
/*
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}
*/
/*
- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];
}
*/
/*
- (void)viewDidDisappear:(BOOL)animated {
	[super viewDidDisappear:animated];
}
*/


 // Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
	// Return YES for supported orientations.
	return NO;
}



#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Relinquish ownership any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
}


- (void)dealloc {
	[fileTable release];
	[prefsTable release];
    [super dealloc];
}


@end

